//用程序生成一个数，让程序来猜这个数  ^-^
//夏梓豪
//2023/03/30
package test_循环高级练习;

import java.util.Random;
import java.util.Scanner;

public class test5 {
    public static void main(String[] args) {
        Random r = new Random();
        int number = r.nextInt(100)+1;
        int counter = 0 ;
        while(true){
            int ComGuessNum = r.nextInt(100)+1;
            if (ComGuessNum==number){
                System.out.println("电脑猜了"+counter+"次");
                break;
            }
        counter++;
        }
    }
}
